Skip to content

Comments

[FIX] Run tests for modules with auto_install=True (Odoo >= 19.0)#116

Open
ivantodorovich wants to merge 1 commit intoOCA:masterfrom
camptocamp:fix-19-auto-install-not-tested
Open

[FIX] Run tests for modules with auto_install=True (Odoo >= 19.0)#116
ivantodorovich wants to merge 1 commit intoOCA:masterfrom
camptocamp:fix-19-auto-install-not-tested

Conversation

@ivantodorovich
Copy link
Contributor

In Odoo 19.0+, the behavior of odoo -i <module-name> changed: it no longer re-installs modules that are already installed in the database.

This creates a problem for testing auto-installable modules. Here's the sequence:

  1. During database initialization, we install all dependencies of the addons to test using odoo -i <dependencies>
  2. Auto-installable modules get automatically installed at this step because their dependencies are now satisfied
  3. Later, when we run tests with odoo -i <auto-installable-module>, Odoo sees the module is already installed and skips the installation process
  4. Since the module installation is skipped, its unit tests are never executed

The fix ensures that auto-installable modules are properly excluded during the initial database setup, so they can be explicitly installed (and tested) during the test execution phase.

To achieve this, we leverage the newly added skip-auto-install parameter for Odoo 19.0+.

Fixes #115

In Odoo 19.0+, the behavior of `odoo -i <module-name>` changed: it no longer
re-installs modules that are already installed in the database.

This creates a problem for testing auto-installable modules. Here's the sequence:

1. During database initialization, we install all dependencies of the addons
   to test using `odoo -i <dependencies>`
2. Auto-installable modules get automatically installed at this step because
   their dependencies are now satisfied
3. Later, when we run tests with `odoo -i <auto-installable-module>`, Odoo
   sees the module is already installed and skips the installation process
4. Since the module installation is skipped, its unit tests are never executed

The fix ensures that auto-installable modules are properly excluded during
the initial database setup, so they can be explicitly installed (and tested)
during the test execution phase.

To achieve this, we leverage the newly added `skip-auto-install` parameter
for Odoo 19.0+.

Fixes OCA#115
@sbidoul
Copy link
Member

sbidoul commented Jan 20, 2026

That's when I regret to have used bash :)

Copy link

@twalter-c2c twalter-c2c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@OCA-git-bot
Copy link

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@ivantodorovich
Copy link
Contributor Author

@sbidoul your review is welcomed 🙏🏻

let me know if you prefer we rewrite this in python, instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with Odoo 19.0: tests not running for auto-installable modules

6 participants